#include<iostream>
using namespace std;
#include<vector>


// Definition for a Node.
class Node {
public:
    int val;
    vector<Node*> children;

    Node() {}

    Node(int _val) {
        val = _val;
    }

    Node(int _val, vector<Node*> _children) {
        val = _val;
        children = _children;
    }
};

vector<vector<int>> levelOrder(Node* root) {
    Node* cur = root;

    vector<Node*> temp;
    vector<vector<int>> traveNode;
    temp.push_back(root);

    int left = 0;
    int right = 0;

    int curNumber = 0;
    vector<int> tempInt;

    while (cur && left <= right)
    {
        curNumber = 0;
        while (left <= right)
        {
            cur = temp[left];
            tempInt.push_back(cur->val);
            for (int i = 0; i < cur->children.size(); i++)
            {
                temp.push_back(cur->children[i]);
                curNumber++;
            }
            left++;
        }

        traveNode.push_back(tempInt);
        tempInt.clear();

        right += curNumber;

    }
    return traveNode;
}


int main()
{

}